<template>
  <div class="father">
    <div class="biaoti">业务信息:</div><br/>
    <div class="neirong">业务id:<input class="readonly" type="text" readonly :value="service.serviceid"/></div>
    <div class="neirong">业务编号:<input class="readonly" type="text" readonly :value="service.servicenumber" /></div>
    <div class="neirong">业务类型:<input class="readonly" type="text" readonly :value="service.servicetype"/></div>
    <br/>
    <div class="biaoti">申请人基本信息:</div><br/>
    <div class="neirong">申请人:<input class="readonly" type="text" readonly :value="proposer.clientname"/></div>
    <div class="neirong">申请人身份证号码:<input class="readonly" type="text" readonly  :value="proposer.idcard"/></div>
    <div class="neirong" style="padding-right: 30%">联系电话:<input class="readonly" type="text" readonly :value="proposer.phone"/></div>
    <br/>
    <div class="neirong">代理人:<input class="readonly" type="text" readonly :value="agent.clientname"/></div>
    <div class="neirong">代理人身份证号码:<input class="readonly" type="text" readonly :value="agent.idcard"/></div>
    <br/>
    <div class="biaoti">他项权(在建)信息:</div><br/>
    <div class="shuru1">一般抵押:<input type="text" id="generalmortgage" /></div>
    <div class="shuru1">最高抵押:<input  type="text" id="maxmortgage"/></div>
    <div class="shuru1" >抵押权人:<input type="text" id="mortgagee"/></div>
    <div class="shuru1">抵押人:<input type="text" id="mortgager"/></div>
    <div class="shuru1">在建工程坐落:<input type="text" id="location"/></div>
    <div class="shuru1">最高债权数额:<input type="text" id="maxclaim"/></div>
    <div class="shuru1">债务履行期限:<input type="text" id="returntime"/></div>
    <div class="shuru1">抵押登记证明号:<input type="text" id="identificationnumber"/></div>
    <div class="shuru1">最高债权确定事实和数额:<input type="text" id="maxfact"/></div>

    <div class="biaoti">房产信息:</div><br/>
    <div class="shuru">房屋门牌号:<input type="text" id="roomnumber" /><input  class="button" type="button" value="查询" @click="findroom()"/></div>
    <div class="neirong">总面积:<input class="readonly" type="text" readonly :value="building.totalarea"/></div>
    <div class="neirong" >楼层:<input class="readonly" type="text" readonly :value="building.floor" /></div>
    <div class="neirong" style="padding-right: 30%">楼栋名称:<input class="readonly" type="text" readonly :value="building.buildingname"/></div>
    <div class="neirong">楼栋编号:<input class="readonly" type="text" readonly :value="building.buildingnumber"/></div>
    <div class="neirong">分户房屋:<input class="readonly" type="text" readonly :value="building.count"/></div>

    <div class="biaoti">交验证件:</div><br/>
    <div class="shuru1">登记申请书:<input type="file" id="sqs"/></div>
    <div class="shuru1">身份证复印件:<input type="file" id="sfz"/></div>
    <div class="shuru1">一寸照片:<input type="file" id="zp"/></div>
    <div class="shuru1">购房发票复印件:<input type="file" id="fp"/></div>
    <div class="shuru1">购房合同复印件:<input type="file" id="ht"/></div>
    <div class="shuru1">税证复印件:<input type="file" id="sz"/></div>
    <div class="shuru"><input type="button" value="提交审核" class="button1" @click="tijiao()"/></div>
    <input type="hidden" id="bmid"/>
    <input type="hidden" id="roomid"/>
  </div>
</template>

<script>
export default {
  name: "txqzjLuRu",
  props:['params'],
  data(){
    return{
      sid:this.params.id,
      service:{
        servicenumber: null,
        serviceid:null,
        servicetype:null
      },
      proposer:{
        clientname:null,
        idcard:null,
        phone:null,
      },
      agent: {
        clientname:null,
        idcard:null,
      },
      building: {
        buildingid: null,
        buildingname: null,
        buildingnumber: null,
        floor: null,
        count: null,
        totalarea: null,
        descripe: null,
        hid: null
      },
      room:{
        roomid:null,
        roomnumber:null
      }
    }
  },
  mounted() {
    this.show();
  },
  methods:{
    show(){
      this.sa.ajax("/cha/zj?serviceid="+this.sid,{},
          function (resp){
            console.log(resp);
            $("#emid").val(resp.data.beinmortgage.id);
            this.service.serviceid = resp.data.service.serviceid;
            this.service.servicenumber =  resp.data.service.servicenumber;
            this.service.servicetype = resp.data.servicetype.servicetype;
            this.proposer.clientname = resp.data.proposer.clientname;
            this.proposer.idcard = resp.data.proposer.idcard;
            this.proposer.phone = resp.data.proposer.phone;
            this.agent.clientname = resp.data.agent.clientname;
            this.agent.idcard = resp.data.agent.idcard;
          }.bind(this),
          {type: 'get'}

      )
    },
    findroom(){
      var i = $("#roomnumber").val();
      this.sa.ajax("/cha/fang?roomnumber="+i,{},
          function (resp){
            if(resp.msg=='success'){
              $("#roomid").val(resp.data.room.roomid);
              this.building.buildingid=resp.data.building.buildingid;
              this.building.buildingname=resp.data.building.buildingname;
              this.building.buildingnumber=resp.data.building.buildingnumber;
              this.building.floor=resp.data.building.floor+'层';
              this.building.count=resp.data.building.count;
              this.building.totalarea=resp.data.building.totalarea+'平方';
              this.building.descripe=resp.data.building.descripe;
              this.building.hid=resp.data.building.hid;
              this.room.roomid =resp.data.room.roomid;
            }else{
              alert("未查询出数据");
              this.building.buildingid='';
              this.building.buildingname='';
              this.building.buildingnumber='';
              this.building.floor='';
              this.building.count='';
              this.building.totalarea='';
              this.building.descripe='';
              this.building.hid='';
            }

          }.bind(this),
          {type: 'get'}
      )
    },
    findren(){
      var i = $("#ren").val();
      this.sa.ajax("/cha/renming?ren="+i,{},
          function (resp){
            if(resp.msg=='success'){
              this.client.phone =resp.data.phone;
              this.client.idcard = resp.data.idcard;
            }else{
              alert("未查询出数据");
              this.client.phone ='';
              this.client.idcard = '';
            }

          }.bind(this),
          {type: 'get'}
      )
    },
    tijiao(){

        var sq= $("#sqs").val()+"";
        var sqs = sq.split('\\');
        var sf= $("#sfz").val()+"";
        var sfz = sf.split('\\');
        var z= $("#zp").val()+"";
        var zp = z.split('\\');
        var f = $("#fp").val()+"";
        var fp = f.split('\\');
        var h = $("#ht").val()+"";
        var ht = h.split('\\')
        var s = $("#sz").val()+"";
        var sz = s.split('\\')
        this.sa.ajax("/yewu/tqxzj",{
              bmid:$("#bmid").val(),
              serviceid:this.sid,
              generalmortgage:$("#generalmortgage").val(),
              maxmortgage:$("#maxmortgage").val(),
              mortgagee:$("#mortgagee").val(),
              mortgager:$("#mortgager").val(),
              location:$("#location").val(),
              scope:$("#scope").val(),
              maxclaim:$("#maxclaim").val(),
              returntime:$("#returntime").val(),
              identificationnumber:$("#identificationnumber").val(),
              maxfactr:$("#maxfactr").val(),
              roomid:$("#roomid").val(),
              applicationpath:sqs[sqs.length-1],
              idcopypath:sfz[sfz.length-1],
              photopath:zp[zp.length-1],
              purchasecopypath:fp[fp.length-1],
              contractcopypath:ht[ht.length-1],
              taxcopypath:sz[sz.length-1],
            },
         function(){
                 alert("提交成功，信息已入库");
                 var tab = {id: 'ShenHe', name: '审核', view: () => import('@/sa-view/jkt/LuRu/syqLuRu.vue'), params: {} };
                 this.sa_admin.showTab(tab);
           }
        ).bind(this),
            {type: 'post'}

    }
  }
}
</script>

<style scoped>
.readonly{
  background-color: gray;
  color : white;
}
.father{
  width: 95%;
  height: 800px;
  padding-left: 5%;
}
.biaoti{
  float: left;
  padding-top: 1.5%;
  border-bottom: 1px solid black;
  width: 100%;
}
.neirong{
  float: left;
  padding-right: 2.5%;
  padding-top: 0.5%;
}
.button{
  border-radius: 10px;
  background-color: #42b983;
  color: white;
  border: 2px seagreen solid;
  width: 60px;
  height: 25px;
}

.button1{
  border-radius: 2px;
  background-color: cornflowerblue;
  color: white;
  border: 2px darkblue solid;
  width: 70px;
  height: 25px;
}
.shuru{
  float: left;
  padding-top: 1.5%;
  width: 100%;
}
.shuru1{
  float: left;
  padding-top: 1.5%;
  width: 50%;
}
</style>
